package Java0311;

import java.util.Scanner;

public class ReGoldbach {
    public static void main(String[] args) {
        //重写哥德巴赫猜想
        Scanner scan = new Scanner(System.in);
        System.out.print("请输入一个整数：");
        int number;
        while (true) {
            number = scan.nextInt();
            if (number > 6 && number % 2 == 0) {
                break;
            }
            System.out.println("重新输入：");
        }
        //把number分解成两个数字的和,分别验证是不是质数，
        for (int i = 3, j = number - 3; i < j; i++, j--) {
            int x = 2, y = 2;
            while (x * x < i && i % x != 0) {
                x++;
            }
            if (x * x > i) {
                while (y * y < j && j % y != 0) {
                    y++;
                }
                if (y * y > j) {
                    System.out.println("找到满足哥德巴赫猜想的结果：" + i + "+" + j + "=" + number);
                    break;
                }
            }
        }
    }
}
